<template>
  <div class="success" v-if="props.result">
    <DynamicSuccess />
    <div>
      <h2 class="mb-3 mt-10 text-2xl font-bold text-center xl:text-3xl enter-x xl:text-center">修改成功</h2>
    </div>
  </div>
  <div class="fail" v-if="!props.result">
    <DynamicError />
    <div>
      <h2 class="mb-3 mt-10 text-2xl font-bold text-center xl:text-3xl enter-x xl:text-center">修改失败</h2>
    </div>
  </div>

  <div class="md:flex mx-10 my-10">
    <Button type="primary" @click="handleEdit" size="large" block :loading="loading" class="mx-5"> 继续修改</Button>
    <Button size="large" block @click="handleBack"> 返回首页</Button>
  </div>
</template>

<script lang="ts" setup>
import { Button } from 'ant-design-vue';
import DynamicSuccess from '/@/components/DynamicResult/DynamicSuccess.vue';
import DynamicError from '/@/components/DynamicResult/DynamicError.vue';
import { SaaSPageEnum } from '/@/enums/pageEnum';
import { useGo } from '/@/hooks/web/usePage';
import { useUserStoreWithout } from '/@/store/modules/user';

const go = useGo();
const userStore = useUserStoreWithout();
const emits = defineEmits(['edit']);
const props = defineProps({ result: Boolean });

const handleEdit = () => {
  emits('edit');
};

const handleBack = () => {
  if (userStore.getUserInfo.userType === 0) {
    go(SaaSPageEnum.PLATFORM_HOEMPAGE);
  } else {
    go(SaaSPageEnum.TENANT_HOMEPAGE);
  }
};
</script>
